<!DOCTYPE HTML>
<html>
<head>
    <meta charset="UTF-8">
    <title>奖励制定</title>
    <link rel="stylesheet" type="text/css" href="layui/css/layui.css">
    <style type="text/css">
        .layui-table-cell {
            height: 100%;
            max-width: 100%;
        }
    </style>
</head>
<body>

<div style="margin-left: 50px; width: 1200px">
    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>签到1天</legend>
    </fieldset>
    <div id="slide1" class="demo-slider"></div>

    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>签到2天</legend>
    </fieldset>
    <div id="slide2" class="demo-slider"></div>

    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>签到3天</legend>
    </fieldset>
    <div id="slide3" class="demo-slider"></div>

    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>签到4天</legend>
    </fieldset>
    <div id="slide4" class="demo-slider"></div>

    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>签到5天</legend>
    </fieldset>
    <div id="slide5" class="demo-slider"></div>

    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>签到6天</legend>
    </fieldset>
    <div id="slide6" class="demo-slider"></div>

    <fieldset class="layui-elem-field layui-field-title" style="margin-top: 20px;">
        <legend>签到7天</legend>
    </fieldset>
    <div id="slide7" class="demo-slider"></div>
</div>



<script type="text/javascript" src="layui/layui.js"></script>
<script type="text/javascript" src="js/jquery-1.8.3.min.js"></script>
<script type="text/javascript">


    layui.use(['layer','slider'],function () {

        var layer = layui.layer;
        var slider = layui.slider;

        //渲染
        var ins1 = slider.render({
            elem: '#slide1' //绑定元素
            ,max: 2000
            ,tips: true
            ,setTips: function(value){ //自定义提示文本
            return value + '积分';
            }
            ,theme: '#FF0000' //主题色
            ,input: true
            ,change: function(value){
                var split = value.split('积分');
                $.ajax({
                    url:'sign/update',
                    type:'put',
                    data: {
                        id : 1,
                        reward: split[0]
                    },
                    dataType:'json',
                    success:function (result) {

                    }
                })
            }
        });

        var ins2 = slider.render({
            elem: '#slide2' //绑定元素
            ,max: 2000
            ,tips: true
            ,setTips: function(value){ //自定义提示文本
                return value + '积分';
            }
            ,theme: '#FF7F00' //主题色
            ,input: true
            ,change: function(value){
                var split = value.split('积分');
                $.ajax({
                    url:'sign/update',
                    type:'put',
                    data: {
                        id : 2,
                        reward: split[0]
                    },
                    dataType:'json',
                    success:function (result) {

                    }
                })
            }
        });

        var ins3 = slider.render({
            elem: '#slide3' //绑定元素
            ,max: 2000
            ,tips: true
            ,setTips: function(value){ //自定义提示文本
                return value + '积分';
            }
            ,theme: '#FFFF00' //主题色
            ,input: true
            ,change: function(value){
                var split = value.split('积分');
                $.ajax({
                    url:'sign/update',
                    type:'put',
                    data: {
                        id : 3,
                        reward: split[0]
                    },
                    dataType:'json',
                    success:function (result) {

                    }
                })
            }
        });

        var ins4 = slider.render({
            elem: '#slide4' //绑定元素
            ,max: 2000
            ,tips: true
            ,setTips: function(value){ //自定义提示文本
                return value + '积分';
            }
            ,theme: '#00FF00' //主题色
            ,input: true
            ,change: function(value){
                var split = value.split('积分');
                $.ajax({
                    url:'sign/update',
                    type:'put',
                    data: {
                        id : 4,
                        reward: split[0]
                    },
                    dataType:'json',
                    success:function (result) {

                    }
                })
            }
        });

        var ins5 = slider.render({
            elem: '#slide5' //绑定元素
            ,max: 2000
            ,tips: true
            ,setTips: function(value){ //自定义提示文本
                return value + '积分';
            }
            ,theme: '#00FFFF' //主题色
            ,input: true
            ,change: function(value){
                var split = value.split('积分');
                $.ajax({
                    url:'sign/update',
                    type:'put',
                    data: {
                        id : 5,
                        reward: split[0]
                    },
                    dataType:'json',
                    success:function (result) {

                    }
                })
            }
        });

        var ins6 = slider.render({
            elem: '#slide6' //绑定元素
            ,max: 2000
            ,tips: true
            ,setTips: function(value){ //自定义提示文本
                return value + '积分';
            }
            ,theme: '#0000FF' //主题色
            ,input: true
            ,change: function(value){
                var split = value.split('积分');
                $.ajax({
                    url:'sign/update',
                    type:'put',
                    data: {
                        id : 6,
                        reward: split[0]
                    },
                    dataType:'json',
                    success:function (result) {

                    }
                })
            }
        });

        var ins7 = slider.render({
            elem: '#slide7' //绑定元素
            ,max: 2000
            ,tips: true
            ,setTips: function(value){ //自定义提示文本
                return value + '积分';
            }
            ,theme: '#8B00FF' //主题色
            ,input: true
            ,change: function(value){
                var split = value.split('积分');
                $.ajax({
                    url:'sign/update',
                    type:'put',
                    data: {
                        id : 7,
                        reward: split[0]
                    },
                    dataType:'json',
                    success:function (result) {

                    }
                })
            }
        });


       $.ajax({
           url:'sign/reward',
           type:'get',
           dataType:'json',
           success:function (result) {
               if (result.code == 200) {
                   ins1.setValue(result.data.days1);
                   ins2.setValue(result.data.days2);
                   ins3.setValue(result.data.days3);
                   ins4.setValue(result.data.days4);
                   ins5.setValue(result.data.days5);
                   ins6.setValue(result.data.days6);
                   ins7.setValue(result.data.days7);
               }
           }
       })






    });
</script>


</body>
</html>